1
/****************************** Module Header ******************************\
2 * Module Name: ChatRoom.cs
3 * Project: CSASPNETAJAXWebChat
4 * Copyright (c) Microsoft Corporation
6 * The project illustrates how to design a simple AJAX web chat application.
7 * We use jQuery, ASP.NET AJAX at client side and Linq to SQL at server side.
8 * In this sample, we could create a chat room and invite someone
9 * else to join in the room and start to chat.
11 * In this file, we create a DataContract class which used to serialize the
12 * ChatRoom data to the client side.
14 * This source is subject to the Microsoft Public License.
15 * See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
16 * All other rights reserved.
18 \*****************************************************************************/
23 using System
.Runtime
.Serialization
;
25 namespace WebChat
.Logic
31 public Guid RoomID { get; private set; }
33 public string RoomName { get; private set; }
35 public int MaxUser { get; private set; }
37 public int CurrentUser { get; private set; }
39 public ChatRoom(Guid id
)
41 WebChat
.Data
.SessionDBDataContext db
= new Data
.SessionDBDataContext();
42 var room
= db
.tblChatRooms
.SingleOrDefault(r
=> r
.ChatRoomID
== id
);
46 RoomName
= room
.ChatRoomName
;
47 MaxUser
= room
.MaxUserNumber
;
48 CurrentUser
= room
.tblTalkers
.Count(t
=> t
.CheckOutTime
== null);